<?php

use yii\db\Migration;

/**
 * Handles the creation of table `goods`.
 */
class m170329_113057_create_goods_table extends Migration
{
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('goods', [
            'id' => $this->primaryKey(),
            'name'=>$this->string(50)->comment('名称'),
            'sn'=>$this->char(15)->comment('货号'),
            'logo'=>$this->string(150)->comment('商品LOGO'),
            'goods_category_id'=>$this->integer(3)->defaultValue(0)->unsigned()->comment('商品分类'),
            'brand_id'=>$this->smallInteger(5)->defaultValue(0)->unsigned()->comment('品牌'),
            'market_price'=>$this->decimal(10,2)->defaultValue(0.00)->unsigned()->comment('市场价格'),
            'shop_price'=>$this->decimal(10,2)->defaultValue(0.00)->unsigned()->comment('本店价格'),
            'stock'=>$this->integer(11)->defaultValue(0)->comment('库存'),
            'is_on_sale'=>$this->string(4)->defaultValue(1)->comment('是否上架1是0否'),
            'status'=>$this->integer(4)->defaultValue(1)->comment('1正常0回收站'),
            'sort'=>$this->integer(4)->defaultValue(20)->comment('排序'),
            'inputtime'=>$this->integer(11)->defaultValue(0)->comment('录入时间'),
            'update_at'=>$this->integer()->comment('更新时间'),

        ]);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('goods');
    }
}
